import Vue from 'vue'
import Vuex from 'vuex'
import VuexPersist from 'vuex-persist'
Vue.use(Vuex)

const vuexLocal = new VuexPersist({
  storage: window.localStorage
})

export default new Vuex.Store({
  state: {
   
    login1:0,
    xiang:{},
    users:{},
    car:[],
    shop:{},
    pingJia:{}
  },
  getters:{
    getDing(state){
      return state.di;
    }
  },
  mutations: {
   
    setLogin(state,value){
      // console.log(value);
      state.login1=value;
      // console.log(state);

    },
    setXiang(state,value){
      // console.log(value)
      state.xiang=value;
      // console.log(state.xiang)
    },
    setUser(state,value){
      state.users=value
    },
    setCar(state,value){
      // state.car = state.car.concat(value);
      state.car=value
    },
    setShop(state,value){
      state.shop=value
    },
    setPingJia(state,value){
      state.pingJia=value;
    }
  },
  actions: {
    myDing(store,value){
      console.log(store,value)
      store.state.di=value;
    }
  },
  modules: {
  },
  plugins: [vuexLocal.plugin]
})
